package tako.wisers.com.android.apis.setting;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;

import android.database.sqlite.SQLiteDatabase;

import tako.wisers.com.android.apis.database.SQListManager;
import tako.wisers.com.android.apis.item.SettingItem;

public class SettingManager extends Hashtable<Integer, SettingItem>{
	private static final long serialVersionUID = 7759612186063160599L;
	private static SettingManager mSettings;
	private SQListManager mSqlmanager;
	
	private SettingManager(){
		mSqlmanager = SQListManager.getInstance();
	}
	
	public static SettingManager getInstance(){
		if(mSettings == null){
			mSettings = new SettingManager();
		}
		return mSettings;
	}
	
	public void updateSetting(SettingItem item){
		mSettings.put(item.getId(), item);
		List<SettingItem> tempList = new ArrayList<SettingItem>();
		tempList.add(item);
		mSqlmanager.update(tempList, "id=" + item.getId(), false);
	}
}
